$(document).ready(function() {
    function getDom() {
        $("table .btn.btn-info").on({
            click: function() {
                var t = $(this).parent().parent("tr"),
                    e = t.children(".suggestion");
                $("#viewModal .suggestion").html(e.text()),
                    $("#viewModal").modal("toggle")
            }
        })
    }
    function setReadById() {
        $("table .btn.btn-success").on({
            click: function() {
                var trContent = $(this).parent().parent("tr"),
                    trId = trContent.children(".id");
                $.ajax({
                    method: "GET",
                    url: "setRead?feedbackId=" + trId.text(),
                    success: function() {
                        trContent.remove();
                        var trId = $(".panel .panel-body .text-danger");
                        trId.text(trId.text() - 1)
                    }
                })
            }
        })
    }
    getDom(),
        $("#viewModal").on("hidden.bs.modal",
            function() {
                $(this).removeData("bs.modal")
            }),
        setReadById()
});